
public class P11342_39643 {

	static String readLn() {
		String newLine = System.getProperty("line.separator");
		StringBuilder buffer = new StringBuilder();
		int car = -1;
		try {
			car = System.in.read();
			while ((car > 0) && (car != newLine.charAt(0))) {
				buffer.append((char) car);
				car = System.in.read();
			}
			if (car == newLine.charAt(0))
				System.in.skip(newLine.length() - 1);
		} catch (java.io.IOException e) {
			return (null);
		}
		if ((car < 0) && (buffer.length() == 0))
			return (null);
		return (buffer.toString());
	}
	
	static int[] array;
	static int[][] results = new int[50001][3];
	public static void main(String[] args) {
		array = new int[224];
		for (int k = 0; k <= 223; k++) 
			array[k] =  k * k;
	
		precalc();
		
		int cases = Integer.parseInt(readLn());
		
		for (int k = 0; k < cases; k++) {
			int n = Integer.parseInt(readLn());
			
			if (results[n][0] == -1) {
				System.out.println(-1);
			} else System.out.println(results[n][0] + " " + results[n][1] + " " + results[n][2]);
		}
		
	}
	
	private static void precalc() {
		for (int k = 0; k < 50001; k++) {
			results[k][0] = -1;
			results[k][1] = -1;
			results[k][2] = -1;
		}
		
		int current;
		for (int i = 0; i < 224; i++) {
			for (int j = i; j < 224; j++) {
				for (int a = j; a < 224; a++) {
					current = array[i] + array[j] + array[a];
					if (current > 50000)
						break;
					if (results[current][0] == -1) {
						results[current][0] = i;
						results[current][1] = j;
						results[current][2] = a;
					}
				}
				if (array[i] + array[j] > 50000)
					break;
			}
		}
	}

}
